import mysql from 'mysql2';

/**
 * 数据库 链接 class_laugh_node
 */
let connection = mysql.createConnection({
  host: 'localhost',
  user: 'root',
  password: '1234',
  database: 'class_laugh_node',
});

function openConnection() {
  connection.connect((e) => {
    if (e) console.log(e);
  });
}

function closeConnection() {
  connection.end();
}

openConnection();

export { connection, openConnection, closeConnection };
